package com.jiezheng.huinong.action;

import java.util.ArrayList;
import java.util.List;

import com.jiezheng.huinong.dao.PayManageDAOImpl;
import com.jiezheng.huinong.model.PayInfo;
import com.jiezheng.huinong.util.JqPage;
import com.opensymphony.xwork2.ActionSupport;

public class PayInfoAction extends ActionSupport {

	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = 3164345107526529934L;
	
	private JqPage pageInfo = new JqPage();
	private List<PayInfo> pays = new ArrayList<PayInfo>();
	private String sord = "";
	private String sidx = "";
	
	private String cond = "1";
	
	/**
	 * 列出所有付款信息
	 * 
	 * @return
	 */
	public String listPayInfo() {
		
		Integer total = (new PayManageDAOImpl()).getTotalPayNum(cond);
		Integer totalPage = (Integer) (total / pageInfo.getRows())
				+ ((total % pageInfo.getRows() == 0) ? 0 : 1);
		pageInfo.setTotalPage(totalPage);
		pageInfo.setRecord(total);
		// 取得当前页
		Integer curPage = pageInfo.getPage();
		Integer startRow = (curPage - 1) * pageInfo.getRows();

		pays = (new PayManageDAOImpl()).getPayInfo(cond, startRow,
				pageInfo.getRows());
		return SUCCESS;
	}
	
	public JqPage getPageInfo() {
		return pageInfo;
	}
	public void setPageInfo(JqPage pageInfo) {
		this.pageInfo = pageInfo;
	}
	public List<PayInfo> getPays() {
		return pays;
	}
	public void setPays(List<PayInfo> pays) {
		this.pays = pays;
	}
	public String getSord() {
		return sord;
	}
	public void setSord(String sord) {
		this.sord = sord;
	}
	public String getSidx() {
		return sidx;
	}
	public void setSidx(String sidx) {
		this.sidx = sidx;
	}

	public String getCond() {
		return cond;
	}

	public void setCond(String cond) {
		this.cond = cond;
	}

}
